---
apiVersion: v1
kind: Secret
metadata:
  name: {{ .Chart.Name }}-webhook-tls
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" $.Chart.Name)) | nindent 2 }}
type: kubernetes.io/tls
data:
{{- with .Values.runtimeAuditEngine.internal.webhookCertificate }}
  ca.crt: {{  .ca  | b64enc }}
  tls.crt: {{ .crt | b64enc }}
  tls.key: {{ .key | b64enc }}
  # civetweb combined certificate format
  # https://github.com/civetweb/civetweb/blob/master/docs/OpenSSL.md#creating-a-self-signed-certificate
  falco.pem: {{ printf "%s\n%s" .crt .key | b64enc }}
{{- end }}
